|
|
Killroy Quartermaine <iam### [at] yahoocom> wrote:
> Also, toruses bother me on another level. every other primitive shape (is
> that right? spheres and cones and whatnot... they're primitives?) seems to
> require a location in their basic description, but toruses only want the
> two float values
This may be more technical than what you are interested in, but the
reason why the torus primitive has no location parameter is probably
for speed reasons.
Raytracing a torus is done by calculating the intersections of a
line and fourth order polynomial. I suppose solving the intersection
can be optimized a bit when the torus is sitting in the origin
(I haven't actually tried to make the math myself, so I may be
wrong and the real reason is just that the original coder who
added the torus was lazy, but the performance argument may well
be reasonable).
(By the way, even if you "translate" a torus or apply other
transformations to it, the torus will still be sitting in the
origin, so the transformations you apply to the torus will
actually not affect the complexity of the ray-torus intersection
solving.)
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|